<?php

class service extends Controller {

	function service()
	{
		parent::Controller();	
		
	}
	
	function materail_table($category_id=0)
	{
		$this->load->view("service/material_table");
	}
	function materail_item_delete()
	{
		$this->db->where("code",$_POST["code"]);
		$this->db->delete("material_items");
		echo 1;
	}
	function teacher_request_item($type="insert")
	{	
		if($type=="insert")
		{   $cat_ids = array();
			$cat_ids = $this->session->userdata("cat_ids");
			
			$cat_ids[$_POST["category_id"]]["amount"] = $_POST["amount"];
			$cat_ids[$_POST["category_id"]]["remark"] = $_POST["remark"];
			$this->session->set_userdata("cat_ids",$cat_ids);
		}
		if($type=="delete")
		{
			$cat_ids = $this->session->userdata("cat_ids");
			
			unset($cat_ids[$_POST['category_id']]);
			$this->session->set_userdata("cat_ids",$cat_ids);
			//print_r($cat_ids);
		}
		if($type=="remove")
		{
			$this->session->unset_userdata('cat_ids');
		}
		$this->load->view("service/teacher_request_item");
	}
	function sub_allocation_item_delete($id)
	{
		$this->db->where("sub_alloc_item_id",$id);
		$this->db->delete("sub_allocation_items");
		echo date("d-m-y-h-i-s");
	}
	
}